<template>
  <div>
    首页
    <input type="button" value="登录" @click="go('/login')" />
    <input type="button" value="注册" @click="go('/reg')" />
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },

  components: {},

  methods: {
    //功能：跳转页面
    go(path) {
      //编程式导航
      this.$router.push(path);
    }
  },

  created() {
    //方式一：params对象传参
    console.log(this.$route, 899);
    let { username } = this.$route.params;
    console.log(username, 789);

    //方式二：动态路由传参  /home/1234；去到路由表修改路径  /home/:id
    // let { id } = this.$route.params;
    // console.log(id, 789);

    //方式三：query对象传参
    // let { username } = this.$route.query;
    // console.log(username, 789);
  }
};
</script>

<style scoped></style>
